import VueRouter from 'vue-router'

//引入组件
import Index from '../pages'
import Home from '../pages/home/home'
import Login from '../pages/login/login'
import Register from '../pages/register/register'
import Center from '../pages/center/center'
import Storeup from '../pages/storeup/list'
import AddrList from '../pages/shop-address/list'
import AddrAdd from '../pages/shop-address/addOrUpdate'
import Order from '../pages/shop-order/list'
import OrderConfirm from '../pages/shop-order/confirm'
import Cart from '../pages/shop-cart/list'
import News from '../pages/news/news-list'
import NewsDetail from '../pages/news/news-detail'
import payList from '../pages/pay'

import yonghuList from '../pages/yonghu/list'
import yonghuDetail from '../pages/yonghu/detail'
import yonghuAdd from '../pages/yonghu/add'
import shangjiaList from '../pages/shangjia/list'
import shangjiaDetail from '../pages/shangjia/detail'
import shangjiaAdd from '../pages/shangjia/add'
import peijianfenleiList from '../pages/peijianfenlei/list'
import peijianfenleiDetail from '../pages/peijianfenlei/detail'
import peijianfenleiAdd from '../pages/peijianfenlei/add'
import peijianxinxiList from '../pages/peijianxinxi/list'
import peijianxinxiDetail from '../pages/peijianxinxi/detail'
import peijianxinxiAdd from '../pages/peijianxinxi/add'
import xinpinshangshiList from '../pages/xinpinshangshi/list'
import xinpinshangshiDetail from '../pages/xinpinshangshi/detail'
import xinpinshangshiAdd from '../pages/xinpinshangshi/add'
import zaixianliuyanList from '../pages/zaixianliuyan/list'
import zaixianliuyanDetail from '../pages/zaixianliuyan/detail'
import zaixianliuyanAdd from '../pages/zaixianliuyan/add'
import newstypeList from '../pages/newstype/list'
import newstypeDetail from '../pages/newstype/detail'
import newstypeAdd from '../pages/newstype/add'
import aboutusList from '../pages/aboutus/list'
import aboutusDetail from '../pages/aboutus/detail'
import aboutusAdd from '../pages/aboutus/add'
import systemintroList from '../pages/systemintro/list'
import systemintroDetail from '../pages/systemintro/detail'
import systemintroAdd from '../pages/systemintro/add'
import discusspeijianxinxiList from '../pages/discusspeijianxinxi/list'
import discusspeijianxinxiDetail from '../pages/discusspeijianxinxi/detail'
import discusspeijianxinxiAdd from '../pages/discusspeijianxinxi/add'
import discussxinpinshangshiList from '../pages/discussxinpinshangshi/list'
import discussxinpinshangshiDetail from '../pages/discussxinpinshangshi/detail'
import discussxinpinshangshiAdd from '../pages/discussxinpinshangshi/add'

const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
	return originalPush.call(this, location).catch(err => err)
}

//配置路由
export default new VueRouter({
	routes:[
		{
      path: '/',
      redirect: '/index/home'
    },
		{
			path: '/index',
			component: Index,
			children:[
				{
					path: 'home',
					component: Home
				},
				{
					path: 'center',
					component: Center,
				},
				{
					path: 'pay',
					component: payList,
				},
				{
					path: 'storeup',
					component: Storeup
				},
                {
                    path: 'shop-address/list',
                    component: AddrList
                },
                {
                    path: 'shop-address/addOrUpdate',
                    component: AddrAdd
                },
				{
					path: 'shop-order/order',
					component: Order
				},
				{
					path: 'cart',
					component: Cart
				},
				{
					path: 'shop-order/orderConfirm',
					component: OrderConfirm
				},
				{
					path: 'news',
					component: News
				},
				{
					path: 'newsDetail',
					component: NewsDetail
				},
				{
					path: 'yonghu',
					component: yonghuList
				},
				{
					path: 'yonghuDetail',
					component: yonghuDetail
				},
				{
					path: 'yonghuAdd',
					component: yonghuAdd
				},
				{
					path: 'shangjia',
					component: shangjiaList
				},
				{
					path: 'shangjiaDetail',
					component: shangjiaDetail
				},
				{
					path: 'shangjiaAdd',
					component: shangjiaAdd
				},
				{
					path: 'peijianfenlei',
					component: peijianfenleiList
				},
				{
					path: 'peijianfenleiDetail',
					component: peijianfenleiDetail
				},
				{
					path: 'peijianfenleiAdd',
					component: peijianfenleiAdd
				},
				{
					path: 'peijianxinxi',
					component: peijianxinxiList
				},
				{
					path: 'peijianxinxiDetail',
					component: peijianxinxiDetail
				},
				{
					path: 'peijianxinxiAdd',
					component: peijianxinxiAdd
				},
				{
					path: 'xinpinshangshi',
					component: xinpinshangshiList
				},
				{
					path: 'xinpinshangshiDetail',
					component: xinpinshangshiDetail
				},
				{
					path: 'xinpinshangshiAdd',
					component: xinpinshangshiAdd
				},
				{
					path: 'zaixianliuyan',
					component: zaixianliuyanList
				},
				{
					path: 'zaixianliuyanDetail',
					component: zaixianliuyanDetail
				},
				{
					path: 'zaixianliuyanAdd',
					component: zaixianliuyanAdd
				},
				{
					path: 'newstype',
					component: newstypeList
				},
				{
					path: 'newstypeDetail',
					component: newstypeDetail
				},
				{
					path: 'newstypeAdd',
					component: newstypeAdd
				},
				{
					path: 'aboutus',
					component: aboutusList
				},
				{
					path: 'aboutusDetail',
					component: aboutusDetail
				},
				{
					path: 'aboutusAdd',
					component: aboutusAdd
				},
				{
					path: 'systemintro',
					component: systemintroList
				},
				{
					path: 'systemintroDetail',
					component: systemintroDetail
				},
				{
					path: 'systemintroAdd',
					component: systemintroAdd
				},
				{
					path: 'discusspeijianxinxi',
					component: discusspeijianxinxiList
				},
				{
					path: 'discusspeijianxinxiDetail',
					component: discusspeijianxinxiDetail
				},
				{
					path: 'discusspeijianxinxiAdd',
					component: discusspeijianxinxiAdd
				},
				{
					path: 'discussxinpinshangshi',
					component: discussxinpinshangshiList
				},
				{
					path: 'discussxinpinshangshiDetail',
					component: discussxinpinshangshiDetail
				},
				{
					path: 'discussxinpinshangshiAdd',
					component: discussxinpinshangshiAdd
				},
			]
		},
		{
			path: '/login',
			component: Login
		},
		{
			path: '/register',
			component: Register
		},
	]
})
